package com.songlanyun.modules.marketing.groupbuy.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.songlanyun.common.drive.IBaseService;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.modules.marketing.groupbuy.entity.GroupBuyActivityGoods;
import com.songlanyun.modules.marketing.groupbuy.entity.GroupBuyTeam;
import com.songlanyun.modules.marketing.groupbuy.entity.GroupBuyTeamMember;
import com.songlanyun.modules.order.entity.Order;

import java.util.List;
import java.util.Map;

/**
 * 拼团活动的团
 *
 * @author Mark
 * @email sunlightcs@gmail.com
 * @date 2020-11-27 14:03:39
 */
public interface GroupBuyTeamService extends IBaseService<Long,GroupBuyTeam> {

    /**
     * 下单开团
     * @param order
     * @return
     */
    GroupBuyTeam createTeam(Order order);

    void  validateGroupBuyActivityTime(Long activityId);

    /**
     * 下单参团
     * @param order
     * @return
     */
    GroupBuyTeam joinTeam(Order order);

    /**
     * 订单支付成功（如果是建团中的，开团成功，如果是组团中的支付成功，同时如果人员正好满员,成员完成）
     * @param order
     * @return
     */
    GroupBuyTeam paySuccess(Order order);


    GroupBuyTeam loadById(Long teamId,Boolean tw);

    /**
     * 过期没有组团成功的团
     * @return
     */
    List<GroupBuyTeam> loadBuildExpire();

    /**
     * 过期团处理
     * @param team
     * @return
     */
    GroupBuyTeam expireTeamHandle(GroupBuyTeam team);


    List<GroupBuyTeam> getListByAGIdAndShopId(Long shopId, Long activityGoodsId);

    /**
     * 查询所有的团
     * @param params
     * @return
     */
    PageUtils queryALLPage(Map<String, Object> params);

}

